# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
# Contributor: Patrick Griffis <tingping@tingping.se>

pkgname=xdg-desktop-portal-gtk
pkgver=1.10.0
pkgrel=1
pkgdesc="A GTK+ backend for xdg-desktop-portal"
url="https://github.com/flatpak/xdg-desktop-portal-gtk"
arch=(x86_64)
license=(LGPL)
depends=(gtk3 gnome-desktop gnome-keyring)
makedepends=(xdg-desktop-portal python git)
optdepends=("evince: Print preview")
provides=(xdg-desktop-portal-impl)
_commit=3a9ac80eb720d1ba8a2aecc2108f66b2f737f185  # tags/1.10.0^0
source=("git+https://github.com/flatpak/xdg-desktop-portal-gtk#commit=$_commit"
        build.diff)
sha256sums=('SKIP'
            '43cc8f25956d543166bbdf1413ed4fae067a380cecb7415db1422bdb846c5067')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/^v//;s/-/+/g'
}

prepare() {
  cd $pkgname
  
  # Fix build
  git apply -3 ../build.diff

  NOCONFIGURE=1 ./autogen.sh
}

build() {
  cd $pkgname
  ./configure --prefix=/usr --libexecdir=/usr/lib \
    --enable-wallpaper \
    --enable-screenshot \
    --enable-screencast \
    --enable-background \
    --enable-settings \
    --enable-appchooser
  make 
}

check() {
  cd $pkgname
  make check
}

package() {
  cd $pkgname
  DESTDIR="$pkgdir" make install
}
